@extends('develop.layoutEdit')

@section('css')
    <style>
        .layer-go-back{
            display:none;
        }
    </style>
@endsection


@section('title')
    <li class="cur">
        <span>门店设置</span>
    </li>
@endsection

@section('content')

<div class="form-group">
    <label class="col-sm-3 control-label"><span class="red pr5">*&nbsp;</span>是否开启选店：</label>
    <div class="col-sm-9">
        <div class="layui-form">
            <input type="radio" name="is_open_choose_mall"  value="1" title="是" @if( isset($configure['is_open_choose_mall']) && $configure['is_open_choose_mall'] == 1) checked @endif>
            <input type="radio" name="is_open_choose_mall"  value="0" title="否" @if( !isset($configure['is_open_choose_mall']) || $configure['is_open_choose_mall'] == 0) checked @endif>
        </div>
    </div>
</div>

<div class="form-group">
    <label class="col-sm-3 control-label"><span class="red pr5">*&nbsp;</span>是否开启门店区域：</label>
    <div class="col-sm-9">
        <div class="layui-form">
            <input type="radio" name="is_open_mall_area"  value="1" title="是" @if( isset($configure['is_open_mall_area']) && $configure['is_open_mall_area'] == 1) checked @endif>
            <input type="radio" name="is_open_mall_area"  value="0" title="否" @if( !isset($configure['is_open_mall_area']) || $configure['is_open_mall_area'] == 0) checked @endif>
        </div>
    </div>
</div>

<div class="form-group">
    <label class="col-sm-3 control-label"><span class="red pr5">*&nbsp;</span>是否根据门店区域保存wap首页：</label>
    <div class="col-sm-9" >
        <div class="layui-form">
            <input type="radio" name="wap_index_mall_area"  value="1" title="是" @if( isset($configure['wap_index_mall_area']) && $configure['wap_index_mall_area'] == 1) checked @endif>
            <input type="radio" name="wap_index_mall_area"  value="0" title="否" @if( !isset($configure['wap_index_mall_area']) || $configure['wap_index_mall_area'] == 0) checked @endif>
        </div>
    </div>
</div>

<div class="form-group">
    <label class="col-sm-3 control-label"><span class="red pr5">*&nbsp;</span>是否开启营业员管理多家门店：</label>
    <div class="col-sm-9" >
        <div class="layui-form">
            <input type="radio" name="is_user_manage_many_mall"  value="1" title="是" @if( isset($configure['is_user_manage_many_mall']) && $configure['is_user_manage_many_mall'] == 1) checked @endif>
            <input type="radio" name="is_user_manage_many_mall"  value="0" title="否" @if( !isset($configure['is_user_manage_many_mall']) || $configure['is_user_manage_many_mall'] == 0) checked @endif>
        </div>
    </div>
</div>

<div class="form-group">
    <label class="col-sm-3 control-label"><span class="red pr5">*&nbsp;</span>是否根据门店筛选商品：</label>
    <div class="col-sm-9">
        <div class="layui-form">
            <input type="radio" name="is_choose_goods_by_mall"  value="1" title="是" @if( isset($configure['is_choose_goods_by_mall']) && $configure['is_choose_goods_by_mall'] == 1) checked @endif>
            <input type="radio" name="is_choose_goods_by_mall"  value="0" title="否" @if( !isset($configure['is_choose_goods_by_mall']) || $configure['is_choose_goods_by_mall'] == 0) checked @endif>
        </div>
    </div>
</div>

<div class="form-group">
    <label class="col-sm-3 control-label"></label>
    <div class="col-sm-9">
        <input type="hidden" name="function_id" id="function_id" value="{{ $function_id or ''}}">
        <input type="button"  value="保存" onclick="func.edit();" class="btn btn-success" >
    </div>
</div>

@endsection

@section('js')
    <script>

        layui.use(['form'], function() {
            var form = layui.form();
        });

        var func = {

            //保存
            edit:function(){

                var message_log = '' ;
                var configure = E.getFormValues('edit-form') ;

                //参数判断
                if( E.isEmpty( configure.function_id ) || !E.isInt( configure.function_id ) ) {
                    message_log += '参数错误<br/>' ;
                }

                if( message_log ) {
                    layer.alert( message_log , { icon:2 });
                    return false ;
                }

                layer.confirm("您确认保存该设置吗？",{icon:3,offset:'50px'}, function ( index ){
                    layer.close( index );
                    E.ajax( {
                        type:'get',
                        url: '/lar/develop/function/store/'+function_id,
                        data: configure,
                        dataType:'json',
                        // 返回值判断
                        success: function ( obj ){

                            if ( obj.code == 200 ) {
                                layer.alert( obj.message , { icon: 1,time : 1500 } ) ;
                            } else {
                                layer.alert( obj.message , { icon: 2 } ) ;
                            }
                        }
                    } ) ;
                });
            }

        };

    </script>
@endsection